package com.myzk.example.error;

/**
 * 通用业务异常类
 * @author mayong
 * @date 2020年11月4日
 */
public class BizException extends RuntimeException{
    //异常错误KEY，对应i18n/message配置文件
    private String messageKey;
    //异常错误参数
    private Object[] args;

    public BizException(String messageKey) {
        super(messageKey);
        this.messageKey = messageKey;
        this.args = new Object[]{};
    }

    public BizException(String messageKey,Throwable cause) {
        super(messageKey,cause);
        this.messageKey = messageKey;
        this.args = new Object[]{};
    }

    public BizException(String messageKey, Object[] args) {
        super(messageKey);
        this.messageKey = messageKey;
        this.args = args;
    }

    public BizException(String messageKey,Throwable cause, Object[] args) {
        super(messageKey,cause);
        this.messageKey = messageKey;
        this.args = args;
    }

    public String getMessageKey() {
        return messageKey;
    }

    public void setMessageKey(String messageKey) {
        this.messageKey = messageKey;
    }

    public Object[] getArgs() {
        return args;
    }

    public void setArgs(Object[] args) {
        this.args = args;
    }
}
